<!--
 * @Author: HeAo
 * @Date: 2021-10-15 14:05:01
 * @LastEditTime: 2021-10-15 14:19:55
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \web2103-2105\web2105\3-1-ES6\day07\1-原生ajax.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../"></script>
  <script>
    const baseUrl = 'http://47.94.46.113:8888'
    const queryData = {
      page: 1,
      pageSize: 10
    }
    // 1.实例化http请求对象
    let xhr = new XMLHttpRequest()

    // 2.打开连接，设置请求的配置参数
    // xhr.open('get', baseUrl + '/index/category/findAll')
    xhr.open('get', baseUrl + '/index/article/pageQuery')


    // 3.发送请求并且配置请求体中的参数
    xhr.send()

    // 4.监听http连接状态的改变，获取响应
    xhr.onreadystatechange = () => {
      if (xhr.readyState == 4 && xhr.status == 200) {
        console.log(JSON.parse(xhr.response));
      }
    }
  </script>
</head>

<body>

</body>

</html>